package com.donggua.aichebao.commonui.photo;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.donggua.aichebao.commonui.Dialog.DGFullDialog;
import com.donggua.aichebao.commonui.R;

/**
 * Created by Administrator on 2017-09-04.
 */

public class DGPhotoViewDlg extends DGFullDialog implements View.OnClickListener {
    private String url = null;
    private ImageView imgPhoto;
    public DGPhotoViewDlg(Context context) {
        super(context);

    }

    public void onCreate(Bundle bundle){
        super.onCreate(bundle);
        LinearLayout.LayoutParams fill_parent = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FILL_PARENT,
                LinearLayout.LayoutParams.FILL_PARENT);
        View view = LayoutInflater.from(getContext()).inflate(R.layout.dg_photo_view_layout,null);
        imgPhoto  = view.findViewById(R.id.imgPhoto);
        view.setOnClickListener(this);
        setContentView(view,fill_parent);
    }


    public void setUrl(String url) {
        this.url = url;
//        Glide.with(getContext()).load(url).into(imgPhoto);
    }

    @Override
    public void onClick(View view) {
        closeDialog();
    }

    @Override
    public void show() {
        super.show();
        Glide.with(getContext()).load(url).into(imgPhoto);
    }
}
